from app.models.user import User
from app.extensions import db

#insert code here to create a user

def create_user(username, password,identification,phone):
    user = User(username=username, password=password,identification=identification,phone=phone)
    db.session.add(user)
    db.session.commit()
    return user

# 用username查找用户(找第一个)


def get_user_by_username(username):
    return User.query.filter_by(username=username).first()

def get_all_users():
    return User.query.all()